home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / libx11inc.lha / X11 / Xm / TextP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-13  |  10.7 KB  |  274 lines

  1. /* 
  2.  * (c) Copyright 1989, 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC.
  3.  * ALL RIGHTS RESERVED
  4. */ 
  5. /*   $RCSfile: TextP.h,v $ $Revision: 1.45 $ $Date: 92/07/23 11:48:20 $ */
  6. /*
  7. *  (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  8. /*
  9. *  (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
  10. #ifndef _XmTextP_h
  11. #define _XmTextP_h
  12.  
  13. #include <Xm/PrimitiveP.h>
  14. #include <Xm/TextOutP.h>
  15. #include <Xm/TextInP.h>
  16.  
  17. typedef struct _InputRec *Input;
  18. typedef struct _OutputRec *Output;
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. #define MAXINT    2147483647 /* Biggest number that can fit in long */
  25.  
  26. #define NODELTA        MAXINT
  27.  
  28. #define TEXTWIDGETCLASS    "Text"    /* Resource class for the text widget. */
  29.  
  30. #define GetSrc(widget)  (((XmTextWidget) (widget))->text.source)
  31.  
  32. #ifndef MIN
  33. #define MIN(x,y)    ((x) < (y) ? (x) : (y))
  34. #endif /* MIN */
  35.  
  36. typedef struct {
  37.     XtPointer        extension;    /* Pointer to extension record */
  38. } XmTextClassPart;
  39.  
  40. typedef struct _XmTextClassRec {
  41.     CoreClassPart core_class;
  42.     XmPrimitiveClassPart primitive_class;
  43.     XmTextClassPart text_class;
  44. } XmTextClassRec;
  45.  
  46. externalref XmTextClassRec    xmTextClassRec;
  47.  
  48. typedef struct {
  49.     XmTextPosition start;    /* First position in this line. */
  50.     Boolean changed;        /* TRUE if something in this line changed. */
  51.     XmTextPosition changed_position; /* First position within the line that
  52.                     has changed, if any. */
  53.     Boolean past_end;        /* TRUE if this line is past the end of any */
  54.                 /* line actually on the screen. */
  55.     LineTableExtra extra;    /* Extra info the output module keeps. */
  56. } LineRec, *Line;
  57.  
  58. typedef struct _XmTextLineTableRec{
  59.     unsigned int start_pos:31;
  60.     unsigned int virt_line:1;
  61. } XmTextLineTableRec, *XmTextLineTable;
  62.  
  63. typedef struct {
  64.     XmTextPosition from, to;    /* Information on one range to repaint. */
  65. } RangeRec;
  66.  
  67. typedef struct {
  68.     Cardinal number;        /* Number of ranges defined. */
  69.     Cardinal maximum;        /* Number of ranges we have space for. */
  70.     RangeRec *range;        /* Pointer to array of ranges. */
  71. } Ranges;
  72.  
  73.  
  74. /*
  75.  * Structure for main text info. 
  76.  */
  77.  
  78. typedef struct _XmTextPart {
  79.     XmTextSource source;           /* The source for this widget. */
  80.     XtCallbackList activate_callback;      /* command activate callback. */
  81.     XtCallbackList focus_callback;       /* Focus callback. */
  82.     XtCallbackList losing_focus_callback;  /* Losing focus callback. */
  83.     XtCallbackList value_changed_callback; /* Value changed callback. */
  84.     XtCallbackList modify_verify_callback; /* Verify value to change callback.*/
  85.     XtCallbackList wcs_modify_verify_callback; /* Verify value to change 
  86.                         * callback.*/
  87.     XtCallbackList motion_verify_callback; /* Insert cursor position 
  88.                           change callback. */
  89.     XtCallbackList gain_primary_callback; /* Gained ownership of Primary
  90.                          Selection */
  91.     XtCallbackList lose_primary_callback; /* Lost ownership of Primary
  92.                          Selection */
  93.     char *value;            /* The sring value in the widget */
  94.     wchar_t *wc_value;              /* Pointer for wchar_t value set by app */
  95.     Dimension margin_height;        /* height between text borders and text */
  96.     Dimension margin_width;         /* width between text borders and text */
  97.     Position cursor_position_x;     /* x pixel location of cursor */
  98.     OutputCreateProc output_create; /* Routine to create the output portion. */
  99.     InputCreateProc input_create;   /* Routine to create the input portion. */
  100.     /* The naming incongruity amongst the next three items was introduced */
  101.     /* due to a collision with top_position as used as a Form constraint; */
  102.     /* It has no other implications. */
  103.     XmTextPosition top_character;    /* First position to display. */
  104.     XmTextPosition bottom_position; /* Last position to display. */
  105.     XmTextPosition cursor_position; /* Location of the insertion point. */
  106.     int max_length;            /* Sets the max. length of string */
  107.     int edit_mode;            /* Sets the line editing mode
  108.                        (i.e. sinlge_line, multi_line, ...) */
  109.     Boolean auto_show_cursor_position; /* If true, automatically try to show
  110.                       the cursor position whenever it
  111.                       changes. */
  112.     Boolean editable;          /* Determines if text is editable */
  113.     Boolean verify_bell;       /* Determines if bell is sounded when verify
  114.                    *  callback returns doit - False
  115.                                    */
  116.     Boolean add_mode;          /* Determines the state of add moder */
  117.     Boolean traversed;            /* Flag used with losing focus verification to
  118.                      indicate a traversal key pressed event */
  119.     Boolean in_redisplay;      /* Whether currently in the redisplay proc. */
  120.     Boolean needs_redisplay;      /* Whether we need to repaint or refigure. */
  121.     Boolean in_refigure_lines;      /* Whether currently in refigurelines proc. */
  122.     Boolean needs_refigure_lines; /* Whether we need to refigure. */
  123.     Boolean in_setvalues;         /* Use to reduce unnecessary redisplays and
  124.                      geometry requsets */
  125.     Boolean in_resize;          /* Make sure there are no geometry requests
  126.                      while we are in resize procedure. */
  127.     Boolean in_expose;          /* Make sure there are no geometry requests
  128.                      while we are in expose procedure. */
  129.     Boolean highlight_changed;      /* Whether highlighting recently changed. */
  130.     Boolean pendingoff;         /* TRUE if we shouldn't do pending delete on
  131.                                    the current selection. */
  132.     char char_size;             /* number of bytes for storing a character */
  133.  
  134.     OnOrOff on_or_off;          /* used to halt unecessary motion verify
  135.                      callback calls during primary moves.*/
  136.     Output output;           /* The output portion. */
  137.     Input input;           /* The input portion. */
  138.  
  139.     XmTextPosition first_position; /* First legal position in the source. */
  140.     XmTextPosition last_position;  /* Last legal position in the source. */
  141.     XmTextPosition forget_past;       /* Forget all about positions past this. */
  142.     XmTextPosition force_display;  /* Force this position to be displayed. */
  143.     XmTextPosition new_top;       /* Desired new top position. */
  144.     XmTextPosition last_top_char;  /* Last top position that was displayed. */
  145.     XmTextPosition dest_position;  /* Location of the destination point. */
  146.     int disable_depth;           /* How many levels of disable we've done. */
  147.  
  148.     int pending_scroll;        /* Number of lines we want to scroll. */
  149.     int total_lines;        /* Total number of lines in the text widget */
  150.     int top_line;        /* Line number of the top visible line */
  151.     int vsbar_scrolling;    /* scrolling using the vertical scrollbar */
  152.  
  153.     Cardinal number_lines;    /* Number of line table entries. */
  154.     Cardinal maximum_lines;    /* Maximum number of line table entries. */
  155.     Line line;            /* Pointer to array of line table entries. */
  156.  
  157.     Ranges repaint;        /* Info on the repaint ranges. */
  158.     _XmHighlightData highlight;    /* Info on the highlighting regions. */
  159.     _XmHighlightData old_highlight;/* Old value of above. */
  160.     Widget inner_widget;    /* Pointer to widget which actually contains
  161.                    text (may be same or different from
  162.                    this record).  */
  163.     XmTextLineTable line_table;
  164.     unsigned int table_size;
  165.     unsigned int table_index;
  166. } XmTextPart;
  167.  
  168. typedef struct _XmTextRec {
  169.     CorePart    core;
  170.     XmPrimitivePart primitive;
  171.     XmTextPart text;
  172. } XmTextRec;
  173.  
  174.  
  175. /********    Private Function Declarations    ********/
  176. #ifdef _NO_PROTO
  177.  
  178. extern XmTextPosition _XmTextFindScroll() ;
  179. extern int _XmTextGetTotalLines() ;
  180. extern XmTextLineTable _XmTextGetLineTable() ;
  181. extern void _XmTextRealignLineTable() ;
  182. extern unsigned int _XmTextGetTableIndex() ;
  183. extern void _XmTextUpdateLineTable() ;
  184. extern void _XmTextMarkRedraw() ;
  185. extern LineNum _XmTextNumLines() ;
  186. extern void _XmTextLineInfo() ;
  187. extern LineNum _XmTextPosToLine() ;
  188. extern void _XmTextInvalidate() ;
  189. extern void _XmTextSetTopCharacter() ;
  190. extern int _XmTextCountCharacters() ;
  191. extern void _XmTextSetCursorPosition() ;
  192. extern void _XmTextDisableRedisplay() ;
  193. extern void _XmTextEnableRedisplay() ;
  194.  
  195. #else
  196.  
  197. extern XmTextPosition _XmTextFindScroll( 
  198.                         XmTextWidget widget,
  199.                         XmTextPosition start,
  200.                         int delta) ;
  201. extern int _XmTextGetTotalLines( 
  202.                         Widget widget) ;
  203. extern XmTextLineTable _XmTextGetLineTable( 
  204.                         Widget widget,
  205.                         int *total_lines) ;
  206. extern void _XmTextRealignLineTable( 
  207.                         XmTextWidget widget,
  208.                         XmTextLineTable *temp_table,
  209.                         int *temp_table_size,
  210.                         register unsigned int cur_index,
  211.                         register XmTextPosition cur_start,
  212.                         register XmTextPosition cur_end) ;
  213. extern unsigned int _XmTextGetTableIndex(
  214.             XmTextWidget widget,
  215.             XmTextPosition pos) ;
  216. extern void _XmTextUpdateLineTable( 
  217.                         Widget widget,
  218.                         XmTextPosition start,
  219.                         XmTextPosition end,
  220.                         XmTextBlock block,
  221. #if NeedWidePrototypes
  222.                         int update) ;
  223. #else
  224.                         Boolean update) ;
  225. #endif /* NeedWidePrototypes */
  226. extern void _XmTextMarkRedraw( 
  227.                         XmTextWidget widget,
  228.                         XmTextPosition left,
  229.                         XmTextPosition right) ;
  230. extern LineNum _XmTextNumLines( 
  231.                         XmTextWidget widget) ;
  232. extern void _XmTextLineInfo( 
  233.                         XmTextWidget widget,
  234.                         LineNum line,
  235.                         XmTextPosition *startpos,
  236.                         LineTableExtra *extra) ;
  237. extern LineNum _XmTextPosToLine( 
  238.                         XmTextWidget widget,
  239.                         XmTextPosition position) ;
  240. extern void _XmTextInvalidate( 
  241.                         XmTextWidget widget,
  242.                         XmTextPosition position,
  243.                         XmTextPosition topos,
  244.                         long delta) ;
  245. extern void _XmTextSetTopCharacter(
  246.                       Widget widget,
  247.                       XmTextPosition top_character) ;
  248. extern int _XmTextCountCharacters( 
  249.                         char *str,
  250.                         int num_count_bytes) ;
  251. extern void _XmTextSetCursorPosition( 
  252.                         Widget widget,
  253.                         XmTextPosition position) ;
  254. extern void _XmTextDisableRedisplay( 
  255.                         XmTextWidget widget,
  256. #if NeedWidePrototypes
  257.                         int losesbackingstore) ;
  258. #else
  259.                         Boolean losesbackingstore) ;
  260. #endif /* NeedWidePrototypes */
  261. extern void _XmTextEnableRedisplay( 
  262.                         XmTextWidget widget) ;
  263.  
  264. #endif /* _NO_PROTO */
  265. /********    End Private Function Declarations    ********/
  266.  
  267.  
  268. #ifdef __cplusplus
  269. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  270. #endif
  271.  
  272. #endif /* _XmTextP_h */
  273. /* DON't ADD STUFF AFTER THIS #endif */
  274.